package com.client;

import java.io.StringReader;

import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.StreamSource;

import org.springframework.ws.client.core.WebServiceTemplate;

public class OrderClient {
	//sample request XML
    private static String MESSAGE =
        "<orderRequest xmlns=\"http://www.pentalog.vn/webservice\"><item>Spring Flowers</item><quantity>2</quantity><city>Ahmedabad</city><country>India</country></orderRequest>";

    public static void main(String[] args){
    	//WebServiceTemplate provides the functionality for sending and receiving webservice messages.
        String wsdlUrl = "http://localhost:8080/SoapSpring/soap/order1.wsld";
        StreamSource requestMessage = new StreamSource(new StringReader(MESSAGE));
    	StreamResult responseMessage = new StreamResult(System.out);
    	WebServiceTemplate template = new WebServiceTemplate();
    	template.sendSourceAndReceiveToResult(wsdlUrl, requestMessage, responseMessage);
    }
}
